<?php defined('IN_PHPCMS') or exit('Access Denied'); ?><?php include template('phpcms','header'); ?>
<link href="<?php echo SKIN_PATH;?>modal.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="images/js/jqModal.js"></script>
<div id="main">
  <!--begin left-->
  <div id="main_l">
    <!--导航-->
    <div id="position"><a href="">首页</a><a href="<?php echo $M['url'];?>">问吧</a><?php echo catpos($catid);?></div>
    <div class="cat">
      <h3 class="now"><?php if($status==5) { ?><span class="j_1">已解决</span><?php } elseif ($status==6) { ?><span class="j_1">已关闭</span><?php } else { ?><span class="j_2">未解决</span><?php } ?></h3>
      <div class="question"><?php echo $title;?></div>
      <div class="question_attribute">
  <?php if(!$isask && $status==3 && !$have_answer) { ?><a href="<?php if(!$_userid) { ?><?php echo $MODULE['member']['url'];?>login.php?forward=<?php echo urlencode(URL);?><?php } else { ?><?php echo URL;?>#answerdiv<?php } ?>"><img src="<?php echo $M['url'];?>images/btn_answer.gif" alt="我要回答"/></a>&nbsp;<?php } ?>
  <?php if($reward) { ?>悬赏：<span class="gold"><?php echo $reward;?></span><?php } ?>　<?php if($status==5) { ?> 解决时间：<?php echo date('Y-m-d H:i',$solvetime);?> <?php } elseif ($status==3) { ?>离问题结束还有　<span class="time"><?php echo $day;?>天<?php echo $hour;?>小时<?php echo $minute;?>分</span><?php } ?></div>
      <div class="question_add" >
        <p><span id="askmessage"><?php echo $message;?></span></p>
      </div>
  <div class="answer_list">
       <ul><li class="align_r"><?php if($anonymity) { ?>匿名提问 <?php } else { ?><span class="c_gray">提问者：</span><a href="<?php echo space_url($userid);?>" target="_blank"><?php echo $username;?></a> <?php echo $actor;?> <?php } ?><span class="c_gray"><?php echo date('Y-m-d H:i',$addtime);?><span></li>
       </ul>
      </div>
<?php if($isask && $status==3) { ?>
  <h3 class="tag_box"><span class="tag_menu_1">
  <a href="javascript:show_edit_ask()" onMouseOver="showContentlabel('0')" id="navlabel0"  class="selected" title="点击修改问题补充">问题补充</a>
  <a href="javascript:show_ques_addscore()" onMouseOver="showContentlabel('1')" id="navlabel1" title="点击提高悬赏">提高悬赏</a>
   <a href="javascript:redirect('<?php echo $M['url'];?>query.php?action=over&id=<?php echo $id;?>')" onMouseOver="showContentlabel('2')" id="navlabel2" title="点击结束问题">结束问题</a>
   <samp id="navlabel3">
   <?php if($answercount>1 && $flag!=1) { ?>
  <a href="javascript:redirect('<?php echo $M['url'];?>show.php?action=vote&id=<?php echo $id;?>')" onMouseOver="showContentlabel('3')" >发起投票</a><?php } ?></samp>
 </span></h3>

      <div class="box_1" id="contentlabel0">可以对您的提问补充细节，以得到更准确的答案 
<div id="edit_ask" style="display:none">
<form name="handleform3" action="<?php echo $M['url'];?>query.php?action=edit_ask&id=<?php echo $id;?>" method="post">
<input name="title" id="title" size="35" value='<?php echo $title;?>'>
<textarea name="message" id="message" cols="100" rows="10"></textarea>
<?php if($M[use_editor]) { ?><?php echo form::editor('message','introduce','100%',200,0);?><?php } ?>
<input type="submit" name="dosubmit" value="好了，提交问题补充"/>
<input type="button" name="submit" value="关闭问题补充" onClick="show_edit_ask(1);"/>
</form>
</div>
  </div>
      <div class="box_1" id="contentlabel1" style="display:none;">提高悬赏分，以提高问题的关注度，并获得额外5天问题有效期
<div id="ques_addscore" style="display:none">
<form name="handleform2" action="<?php echo $M['url'];?>query.php" method="post" onsubmit="return ck_addscore(this)">
<select name="point" id="addscore" onchange="ck_addscore();"> 
<option value="5">5</option>
<option value="10">10</option>
<option value="15">15</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="50">50</option>
<option value="80">80</option>
<option value="100">100</option>
<option value="200">200</option>
</select>
您目前的总积分<strong><?php echo $_point;?></strong><span id="addscore_msg"></span><br />
<input type="hidden" name="action" value="addscore" />
<input type="hidden" name="id" value="<?php echo $id;?>" />
<input type="submit" name="dosubmit" value="好了，提交追加悬赏" />
<input type="button" name="submit" value="关闭追加悬赏" onClick="show_ques_addscore(1);"/>
</form>
</div>
</div>
      <div class="box_1" id="contentlabel2" style="display:none;">没有满意的回答，还可直接结束提问，关闭问题 </div>
      <div class="box_1" id="contentlabel3" style="display:none;">不知道哪个回答最好时，可让网友投票来选出最佳答案 </div>
  <?php } ?>
    </div>

    <!--最佳答案-->
<?php if($status==5) { ?>
    <div class="cat">
      <h3 class="good">最佳答案　<span>回答者： <?php echo $optimail_username;?>   <?php echo $optimal_actor;?>     回复时间：<?php echo date('Y-m-d H:i',$answertime);?></span></h3>
      <div class="answer">
        <p><?php echo $answer;?></p>
      </div>
    </div>
<?php } ?>
    <!--其他答案-->
   <div class="cat">
<h3>其他回答<span>(<?php echo $answercount;?>)</span></h3>
  <?php if(is_array($infos)) foreach($infos AS $info) { ?>
      <div class="answer_list">
        <ul>
          <li><span id="answermessage<?php echo $info['pid'];?>"><?php echo $info['message'];?></span></li>
          <li>
<?php if($status==3 && $userid==$_userid && $flag!=0) { ?>
<input type="submit" value="采纳答案" onclick="redirect('<?php echo $M['url'];?>query.php?action=accept_answer&id=<?php echo $id;?>&pid=<?php echo $info['pid'];?>');"/>
<?php } elseif ($status==3 && $_userid==$info[userid] && $flag!=0) { ?>
<input type="button" value="修复答案" onclick="show_edit_answer(0,<?php echo $info['pid'];?>)" id="button_edit"/>
<div id="edit_answer" style="display:none">
<p>
<form name="editanswerForm" action="<?php echo $M['url'];?>query.php" method="post" onsubmit="return check_answerform(this);">
<span id="user_msg"></span>
<textarea name="answertext" id="answertext" type="text" rows="10" cols="100"></textarea>
<?php if($M[use_editor]) { ?><?php echo form::editor('answertext','introduce','100%',200,0);?><?php } ?><br>回答字数在10000字以内
<input type="hidden" name="pid" value="<?php echo $info['pid'];?>">
<input type="hidden" name="action" value="edit_answer">
<input type="submit" name="dosubmit" value="好了，提交修复答案" class="bnsrh" />
<input type="button" name="submit" value="关闭修复答案" class="bnsrh" onClick="show_edit_answer(1);"/>
</form>
</p>
      </div>
<?php } elseif ($flag==1) { ?>
<input type="submit" value="投他一票" onclick="vote(<?php echo $id;?>,<?php echo $info['pid'];?>)"/>
<?php } ?>
          </li>
          <li class="align_r"><?php if($info[anonymity]) { ?>匿名回复<?php } else { ?>回答者：<a href="<?php echo $MODULE['member']['url'];?>view.php?userid=<?php echo $info['userid'];?>"><?php echo $info['username'];?></a> <?php echo $info['actor'];?><?php } ?> 回复时间：<?php echo date('Y-m-d H:i',$info[addtime]);?></li>
        </ul>
      </div>
  <?php } ?>
</div>
<!--其他答案结束-->
<?php if($flag==1) { ?>
 <div class="cat">
      <div class="answer">
        <p><a href="<?php echo $M['url'];?>vote.php?id=<?php echo $id;?>" class="blockcontrol">查看投票结果</a></p>
      </div>
</div>
<?php } ?>

<?php if(!$isask && $status==3 && !$have_answer) { ?>
      <div class="myanswer">
      <h3><a name="answerdiv" id="answerdiv"></a>我要回答　<span>(回答字数请控制在10000字以内)</span></h3>
      <div class="answer">
  <form action="" method="post" name="answerform">
        <textarea name="posts[message]" cols="90" rows="10" id="content" style="margin-bottom:10px;" ></textarea>
<?php if($M[use_editor]) { ?><?php echo form::editor('content','introduce','100%',200,0);?><?php } ?>
<br> 回答即可得<?php echo $M['answer_give_credit'];?>分，回答被采纳则获得悬赏分以及奖励<?php echo $M['answer_bounty_credit'];?>分，回答字数在10000字以内。<br>
匿名设定：<input type="checkbox" name="posts[anonymity]" value="1"><br>
<?php if(!$M[use_editor]) { ?>剩余字数:<input name=remLen id="remLen" value="10000" readonly type=text size="4" maxlength="3" align="absmiddle"><?php } ?><br />
<?php if($M[answer_code]) { ?><div>验证码：<input name="checkcodestr" type="text" size="6" align="absmiddle" style="margin:2px;"/> <img src="checkcode.php" id="checkcode" onClick="this.src='checkcode.php?id='+Math.random()*5;" width="48" align="absmiddle" height="19" alt="验证码,看不清楚?请点击刷新验证码"  /></div>&nbsp;<?php } ?>
        <input name="dosubmit" type="submit" value="提交我的回答" class="mar_10">
</form>
      </div>
    </div>
<?php } ?>  
  </div>
  <!--end left-->
  <!--begin right-->
  <div id="main_r">
    <h4>热点问题</h4>
    <div>
      <ul class="text_list">
       <?php echo tag('ask', 'tag_ask', "SELECT * FROM `zzinfo_ask` WHERE status='3'  ORDER BY hits DESC", 0, 10, array (  'catid' => '0',  'userid' => '',  'flag' => '-1',  'action' => $action,  'urlruleid' => '29',  'class' => 'url',  'target' => '_blank',  'showcatname' => '0',  'titlelen' => '46',));?>
      </ul>
    </div>
    <h4>推荐问题</h4>
    <div class="text_list">
      <ul>
        <?php echo tag('ask', 'tag_ask', "SELECT * FROM `zzinfo_ask` WHERE status='3'  AND catid='$catid' AND flag='3' ORDER BY askid DESC", 0, 10, array (  'catid' => $catid,  'userid' => '',  'flag' => '3',  'action' => $action,  'urlruleid' => '29',  'class' => 'url',  'target' => '_blank',  'showcatname' => '0',  'titlelen' => '46',));?>
      </ul>
    </div>
    <h4 class="tag_box">积分排行<span class="tag_menu_1"><a href="<?php echo $M['url'];?>creditlist.php?action=week" onMouseOver="showContent('0')" id="nav0">上周</a><a href="<?php echo $M['url'];?>creditlist.php?action=month" onMouseOver="showContent('1')" id="nav1">上月</a><a href="<?php echo $M['url'];?>creditlist.php?action=all" onMouseOver="showContent('2')" id="nav2" class="selected">总排行</a></span></h4>
    <div id="content0" style="display:none;">
      <ul class="text_list_1">
  <?php echo tag('ask', 'tag_credit', "SELECT m.userid,m.username,m.preweek AS point,i.lastlogintime,i.logintimes,i.actortype,i.answercount,i.acceptcount FROM `zzinfo_ask_credit` m LEFT JOIN `zzinfo_member_info` i ON m.userid=i.userid ORDER BY preweek DESC", 0, 10, array (  0 => '',  'class' => 'url',  'target' => '_blank',));?>
      </ul>
    </div>
<div id="content1" style="display:none;">
      <ul class="text_list_1">
  <?php echo tag('ask', 'tag_credit', "SELECT m.userid,m.username,m.premonth AS point,i.lastlogintime,i.logintimes,i.actortype,i.answercount,i.acceptcount FROM `zzinfo_ask_credit` m LEFT JOIN `zzinfo_member_info` i ON m.userid=i.userid ORDER BY premonth DESC", 0, 10, array (  0 => '',  'class' => 'url',  'target' => '_blank',));?>
      </ul>
    </div>
<div id="content2">
      <ul class="text_list_1">
  <?php echo tag('ask', 'tag_credit', "SELECT m.userid,m.username,m.point,i.lastlogintime,i.logintimes,i.actortype,i.answercount,i.acceptcount FROM `zzinfo_member` m LEFT JOIN `zzinfo_member_info` i ON m.userid=i.userid ORDER BY point DESC", 0, 10, array (  0 => '',  'class' => 'url',  'target' => '_blank',));?>
      </ul>
    </div>
  </div>
  <!--end right-->
</div>

<div id="toggle_pannel"></div>
<SCRIPT LANGUAGE="JavaScript">
<!--
function killerrors() { 
return true; 
}
$().ready(function() {
window.onerror = killerrors;
$('#toggle_pannel').jqm({ajax: "<?php echo $M['url'];?>vote.php?id=<?php echo $id;?>", modal: true, trigger: 'a.blockcontrol'});
});
var maxlimit=10000;
$('#content').keyup(function() {
<?php if(!$_userid) { ?>redirect('<?php echo $MODULE['member']['url'];?>login.php?forward=<?php echo urlencode(URL);?>');<?php } ?>
data = document.getElementById("content").value.length;
if (data > maxlimit)
{
document.getElementById("content").value = document.getElementById("content").value.substring(0, maxlimit);
}
else
{
var len_rem = maxlimit - data;
$('#remLen').val(len_rem);
}
});

<?php if($_userid) { ?>
function vote(id,pid) {
 $.ajax({
   type: "POST",
   url: '<?php echo $M['url'];?>query.php',
   data: "action=vote&id="+id+"&pid="+pid,
   success: function(msg){
 alert(msg);
}	
}); 
}

function ck_addscore()
{
if($('#addscore').val() > <?php echo $_point;?>)
{
$('#addscore_msg').html("<font color='red'><strong>抱歉,追加悬赏不能高于您目前的总积分.</strong></font>");
return false;
}
else
{
$('#addscore_msg').html();
return true;
}
}
function ck_superadditionscore(obj,id)
{
if(obj.value>30)
{
$('#superadditionscore_msg_'+id).html("<font color='red'><strong>抱歉,追加悬赏不能高于您目前的总积分.</strong></font>");
obj.options[0].selected=true;
return false;
}
else
{
$('#superadditionscore_msg_'+id).html("");
return true;
}
}

function show_ques_addscore(id)
{
if(id)
{
$("#ques_addscore").css("display","none");
}
else
{
$("#ques_addscore").css("display","block");

}
}
function show_edit_answer(id,pid)
{

if(id)
{
$('#edit_answer').css("display","none");
$('#button_edit').css("display","block");
$("#answertext").val('');
}
else
{
<?php if($M['use_editor']) { ?>
$('#edit_answer').css("display","block");
$('#button_edit').css("display","none");
var temp = '#answermessage'+pid;
var s1 = $(temp).html();
FCKeditorAPI.GetInstance('answertext').InsertHtml(s1);
<?php } else { ?>
$('#edit_answer').css("display","block");
$('#button_edit').css("display","none");
var temp = '#answermessage'+pid;
var s1 = $(temp).html();
s1 = s1.replace(/<br>/g,"\n");
s1 = s1.replace(/<BR>/g,"\n");
s1 = s1.replace(/&nbsp;/g,"");
$('#answertext').val(s1);
<?php } ?>
}

}
function show_edit_ask(id)
{


if(id)
{
$('#edit_ask').css("display","none");
$("#message").val('');
}
else
{
    <?php if($M['use_editor']) { ?>
$('#edit_ask').css("display","block");
var s2 = $("#askmessage").html();
FCKeditorAPI.GetInstance('message').InsertHtml(s2);
<?php } else { ?>
$('#edit_ask').css("display","block");
var s2 = $("#askmessage").html();
s2 = s2.replace(/<br>/g,"\n");
s2 = s2.replace(/<BR>/g,"\n");
s2 = s2.replace(/&nbsp;/g,"");
$('#message').val(s2);
<?php } ?>
}
}
<?php } ?>
//-->
</SCRIPT>
<script language="JavaScript">
<!--
function showContent(id)
{
for (var i = 0;i < 3;i++)
{
var nav = document.getElementById("nav" + i);
var content = document.getElementById("content" + i);
if (i == id)
{
nav.className = 'selected';
content.style.display = "";
}
else
{
nav.className = '';        
content.style.display = "none";
}
}
}
function showContentlabel(id)
{
for (var i = 0;i < 4;i++)
{
var navlabel = document.getElementById("navlabel" + i);
var contentlabel = document.getElementById("contentlabel" + i);
if (i == id)
{
navlabel.className = 'selected';
contentlabel.style.display = "";
}
else
{
navlabel.className = '';        
contentlabel.style.display = "none";
}
}
}
 //-->
</script>
<!--end main-->
<!--begin foot-->
<?php include template('phpcms','footer'); ?>